//// TodoMapper.java
//package com.mytools.project.todo.mapper;
//
//import com.mytools.project.todo.entity.Todo;
//import org.apache.ibatis.annotations.*;
//
//import java.util.List;
//
//@Mapper
//public interface TodoMapper {
//
//    @Select("SELECT * FROM todo WHERE user_id = #{userId} ORDER BY created_at DESC")
//    List<Todo> selectByUserId(@Param("userId") String userId);
//
//    @Select("SELECT * FROM todo WHERE id = #{id}")
//    Todo selectById(@Param("id") Long id);
//
//    @Insert("INSERT INTO todo (user_id, title, description, due_date, priority, completed, completed_at) " +
//            "VALUES (#{userId}, #{title}, #{description}, #{dueDate}, #{priority}, #{completed}, #{completedAt})")
//    @Options(useGeneratedKeys = true, keyProperty = "id")
//    int insert(Todo todo);
//
//    @Update("UPDATE todo SET title = #{title}, description = #{description}, due_date = #{dueDate}, " +
//            "priority = #{priority}, completed = #{completed}, completed_at = #{completedAt}, " +
//            "updated_at = NOW() WHERE id = #{id}")
//    int update(Todo todo);
//
//    @Delete("DELETE FROM todo WHERE id = #{id}")
//    int deleteById(@Param("id") Long id);
//
//    // 统计查询
//    @Select("SELECT COUNT(*) FROM todo WHERE user_id = #{userId}")
//    int countTotal(@Param("userId") String userId);
//
//    @Select("SELECT COUNT(*) FROM todo WHERE user_id = #{userId} AND completed = true")
//    int countCompleted(@Param("userId") String userId);
//
//    @Select("SELECT COUNT(*) FROM todo WHERE user_id = #{userId} AND completed = false AND due_date < CURDATE()")
//    int countOverdue(@Param("userId") String userId);
//
//    @Select("SELECT COUNT(*) FROM todo WHERE user_id = #{userId} AND completed = false AND due_date = CURDATE()")
//    int countToday(@Param("userId") String userId);
//}